package mydemo.springcloudalibaba.cousumer.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import lombok.extern.slf4j.Slf4j;
import mydemo.springcloudalibaba.api.common.entity.CommonResult;
import mydemo.springcloudalibaba.cousumer.service.PaymentOpenFiegnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class Controller {
    @Value("${server.port}")
    private String serverPost;
    @Autowired
    private DiscoveryClient discoveryClient;
    @Autowired
    private PaymentOpenFiegnService paymentOpenFiegnService;

    @RequestMapping("/get/{id}")
    @SentinelResource(value = "cousumer")
    public CommonResult getPaymentById(@PathVariable("id") Long id) {
        return paymentOpenFiegnService.getPaymentById(id);
    }
}
